<?php
/**
 * Note: *
 */
namespace App\Http\Controllers\Web;

use App\Caches\Game\BlackIdcardCache;
use App\Caches\Game\BlackIpCache;
use App\Caches\Game\BlackMobileCache;
use App\Caches\Game\BlackUuidCache;
use App\Http\Controllers\Controller;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

class PlatformNotifyController extends Controller
{
    /**
     * @param Request $request
     * @param string $action
     * @return Application|ResponseFactory|Response
     */
    public function index(Request $request, string $action)
    {
        if (!method_exists($this, $action)) abort(404);

        return $this->$action($request);
    }

    /**
     * 重置缓存 黑名单手机号
     * @param Request $request
     * @return Application|ResponseFactory|Response
     */
    public function resetCacheBlackMobile(Request $request)
    {
        BlackMobileCache::reset();
        return responseMessage();
    }

    /**
     * 重置缓存 黑名单IP
     * @param Request $request
     * @return Application|ResponseFactory|Response
     */
    public function resetCacheBlackIp(Request $request)
    {
        BlackIpCache::reset();
        return responseMessage();
    }

    /**
     * 重置缓存 黑名单身份证
     * @param Request $request
     * @return Application|ResponseFactory|Response
     */
    public function resetCacheBlackIdCard(Request $request)
    {
        BlackIdcardCache::reset();
        return responseMessage();
    }

    /**
     * 重置缓存 黑名单设备
     * @param Request $request
     * @return Application|ResponseFactory|Response
     */
    public function resetCacheBlackUuid(Request $request)
    {
        BlackUuidCache::reset();
        return responseMessage();
    }
}
